/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import dto.dlogin;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author HONGPHUOC
 */
public class testconnection {

    dlogin taiKhoan = new dlogin();

    public boolean testconnection(dlogin tk) {
        try {
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(testconnection.class.getName()).log(Level.SEVERE, null, ex);
        }
        String url = "jdbc:sqlserver://" + tk.getHost() + ":" + tk.getPort() + ";databaseName=" + tk.getData();
        try {
            Connection conn = DriverManager.getConnection(url, tk.getUsename(), tk.getPass());
        } catch (Exception ex) {
            return false;
        }

        return true;

    }
}
